home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 234 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.1 KB

  1. Path: axe.netdoor.com!cfleming
  2. From: cfleming@netdoor.com (Chuck Fleming)
  3. Newsgroups: comp.programming,comp.lang.c++,comp.lang.pascal.misc
  4. Subject: Re: How to convert octal-binary?
  5. Followup-To: comp.programming,comp.lang.c++,comp.lang.pascal.misc
  6. Date: 3 Jan 1996 06:58:36 GMT
  7. Organization: Internet Doorway, Inc.
  8. Distribution: world
  9. Message-ID: <4cd9es$lcj@axe.netdoor.com>
  10. References: <4c0nhf$hnl@nyheter.chalmers.se>
  11. NNTP-Posting-Host: lance.netdoor.com
  12. X-Newsreader: TIN [version 1.2 PL2]
  13.  
  14. Cristian Almstrand (christian.almstrand@elektro.ing.hb.se) wrote:
  15. : I really need to know if someone knows about any algoritm to
  16. : convert from a octal value to a hexadecimal or binary?
  17.  
  18. : If you know where to find such an iformation - please let me know.
  19. : All hints are welcome.
  20.  
  21. : Thanks,
  22. : Cristian
  23.  
  24. There is no real difference between an octal, decimal or binary number to the machine.  It's all stored in binary.  Use strtol(const char *, char **end_ptr, int
  25. base) to convert to any string in any base to a number (integer) then just
  26. print it out as a decimal, hex, what have you.  
  27.  
  28. Enjoy!
  29. Chuck Fleming
  30. University of Southern Miss.
  31.